home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / demo / medowl.zip / SOURCE / MEDTFILE.H < prev    next >
C/C++ Source or Header  |  1994-08-18  |  2KB  |  86 lines

  1. #ifndef MAGMA
  2. #define MAGMA
  3. #endif
  4. //----------------------------------------------------------------------------
  5. // ObjectWindows - (C) Copyright 1992, 1993 by Borland International
  6. //   include\owl\editfile.h
  7. //   Definition of class TEditFile, a text edit which can find/replace
  8. //   and read/write from/to a file.
  9. //----------------------------------------------------------------------------
  10. #if !defined(__OWL_MAGMAEDITFILE_H)
  11. #define __OWL_MAGMAEDITFILE_H
  12.  
  13. #if !defined(__OWL_MAGMAEDITSEAR_H)
  14. #if defined(MAGMA)
  15.   #include <owl\medtsear.h>
  16. #else
  17.   #include <owl\editsear.h>
  18. #endif
  19. #endif
  20. #if !defined(__OWL_OPENSAVE_H)
  21.   #include <owl\opensave.h>
  22. #endif
  23. #include <owl\editfile.rh>
  24.  
  25. //
  26. //  class TMagmaEditFile
  27. //  ----- -----------
  28. //
  29. class _OWLCLASS TMagmaEditFile : public TMagmaEditSearch {
  30.   public:
  31.     TOpenSaveDialog::TData FileData;
  32.     char far* FileName;
  33.  
  34.     TMagmaEditFile(TWindow*   parent = 0,
  35.               int             id = 0,
  36.               const char far* text = 0,
  37.               int x = 0, int y = 0, int w = 0, int h = 0,
  38.               const char far* fileName = 0,
  39.               TModule*        module = 0);
  40.  
  41.    ~TMagmaEditFile();
  42.  
  43.     virtual BOOL  CanClear();
  44.     virtual BOOL  CanClose();
  45.  
  46.     void          NewFile();
  47.     void          Open();
  48.     BOOL          Read(const char far* fileName=0);
  49.     void          ReplaceWith(const char far* fileName);
  50.     BOOL          Save();
  51.     BOOL          SaveAs();
  52.     void          SetFileName(const char far* fileName);
  53.     BOOL          Write(const char far* fileName=0);
  54.  
  55.     //
  56.     // command response functions
  57.     //
  58.     void          CmFileNew() {NewFile();}    // CM_FILENEW
  59.     void          CmFileOpen() {Open();}      // CM_FILEOPEN
  60.     void          CmFileSave() {Save();}      // CM_FILESAVE
  61.     void          CmFileSaveAs() {SaveAs();}  // CM_FILESAVEAS
  62.  
  63.     //
  64.     // command enabler functions
  65.     //
  66.     void          CmSaveEnable(TCommandEnabler& commandHandler);    
  67.  
  68.   protected:
  69.     //
  70.     // override virtual functions defined by TWindow
  71.     //
  72.     void          SetupWindow();
  73.  
  74.   private:
  75.     //
  76.     // hidden to prevent accidental copying or assignment
  77.     //
  78.     TMagmaEditFile(const TMagmaEditFile&);
  79.     TMagmaEditFile& operator =(const TMagmaEditFile&);
  80.  
  81.   DECLARE_RESPONSE_TABLE(TMagmaEditFile);
  82.   DECLARE_STREAMABLE(_OWLCLASS, TMagmaEditFile, 1);
  83. };
  84.  
  85. #endif  // __OWL_MAGMAEDITFILE_H
  86.